package com.spider.gk.common;

import java.util.HashMap;
import java.util.Map;

public class CopyOfCopyOfContentAbstractForShop {

	private String content;
	
	public CopyOfCopyOfContentAbstractForShop(String content){
		this.content = content;
	}
	
	public Map<String,String> process(){
		
		
		if(this.content!=null && this.content.length()>0){
			
			Map<String,String> result = new HashMap<String,String>();
			
			int siteNumberCurrent=0;
			
			int herfIndex = content.indexOf("href=\"",siteNumberCurrent);
			
			while(herfIndex>-1){
				herfIndex = content.indexOf("href=\"",siteNumberCurrent);
				if(herfIndex>-1){
					siteNumberCurrent=herfIndex+6;
				}
				int hrefIndexEnd = content.indexOf("\"",herfIndex+8);
//				System.out.println(herfIndex);
//				System.out.println(hrefIndexEnd);
				if(herfIndex>0 && hrefIndexEnd>0){
					String resStrFinal = content.substring(siteNumberCurrent, hrefIndexEnd);
					
					if(!resStrFinal.startsWith("http://item.taobao") && !resStrFinal.startsWith("detail.tmall")){
						continue;
					}
					result.put(resStrFinal,"1");
					System.out.println(resStrFinal);
				}
			}
	

			return result;
		}
		
		return new HashMap<String ,String>();
	}
	
}
